<!DOCTYPE html>
<title>Test adding "source" after removing failed candidate loads media normally.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video>
    <source></source>
</video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    var source = document.querySelector("source");

    source.onerror = t.step_func(function() {
        video.removeChild(video.firstChild);
        var newSource = document.createElement("source");
        newSource.src = "content/test.ogv";
        video.appendChild(newSource);
        video.onloadedmetadata = t.step_func_done();
    });
});
</script>